using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class SkillListPanel : MonoBehaviour
{
    public ScrollRect scrollRect;
    public CircularScrollRect CSR;
    public List<int> data;
    public Button Refresh;
    public Button Hiden;
    public RectTransform panel;

    // Start is called before the first frame update
    void Start()
    {
        // data = new List<int>();
        // for (int i = 0; i < 100; i++)
        // {
        //     data.Add(i);
        // }
        // CSR.Init(UpdateItem);
        // CSR.ShowAndUpdateList(data.Count);
    }

    // Update is called once per frame
    void Update()
    {
        
    }
    // private void UpdateItem(GameObject item, int index)
    // {
    //     // item.GetComponent<Button>().SetBtnText(data[index].ToString());
    //     // item.GetComponentInChildren<Text>().text = data[index].ToString();
    //     item.GetComponent<SkillEditorItem>().Text.text = data[index].ToString();
    //     item.GetComponent<SkillEditorItem>().onClickCallback = OnClickItem;
    // }

    // public void OnClickItem(int index)
    // {
    //     Debug.Log("OnClickItem index:" + index);
    // }

    public void RefreshList()
    {
        CSR.UpdateList();
        Debug.Log("RefreshList");
    }

    public void ShowOrHiden()
    {
        var position = panel.anchoredPosition;
        if(position.x < 0)
        {
            panel.anchoredPosition = new Vector2(0, position.y);
            Hiden.GetComponentInChildren<Text>().text = "隐\n藏";
        }
        else
        {
            panel.anchoredPosition = new Vector2(-panel.sizeDelta.x + 33.5f, position.y);
            Hiden.GetComponentInChildren<Text>().text = "显\n示";
        }
    }
}
